#include "PreCompiled.h"
#include "Command.h"
#include "Application.h"
#include "Document_App.h"
#include "Document_Gui.h"
DEF_STD_CMD(StdCmdOpen);
StdCmdOpen::StdCmdOpen(void)
:Command("Std_Open")
{
	sGroup     = QT_TR_NOOP("File");
	sMenuText  = QT_TR_NOOP("&Open");
	sToolTipText = QT_TR_NOOP("Open a file");
	sWhatsThis  = "Std_Open";
	sStatusTip = QT_TR_NOOP("Open a file");
	sPixmap   = "document-open";
	sAccel   = keySequenceToAccel(QKeySequence::Open);
}

void StdCmdOpen::activated(int iMsg)
{

}

// ------------------------------------- [4/15/2013 Administrator]

DEF_STD_CMD_A(StdCmdSave);
StdCmdSave::StdCmdSave(void)
:Command("Std_Save")
{
	sGroup     = QT_TR_NOOP("File");
	sMenuText  = QT_TR_NOOP("&Save");
	sToolTipText = QT_TR_NOOP("Save a file");
	sWhatsThis  = "Std_Save";
	sStatusTip = QT_TR_NOOP("Save a file");
	sPixmap   = "document-save";
	sAccel   = keySequenceToAccel(QKeySequence::Save);
}

void StdCmdSave::activated(int iMsg)
{
	Application::Instance()->activeDocument()->save();
}
bool StdCmdSave::isActive()
{
	return 1;
}

// ---------------------------------------- [4/15/2013 Administrator]

DEF_STD_CMD_A(StdCmdQuit);
StdCmdQuit::StdCmdQuit(void)
:Command("Std_Quit")
{
	sGroup     = QT_TR_NOOP("File");
	sMenuText  = QT_TR_NOOP("&Quit");
	sToolTipText = QT_TR_NOOP("Quit");
	sWhatsThis  = "Std_Quit";
	sStatusTip = QT_TR_NOOP("Quits the application");
	sPixmap   = "system-log-out";
	sAccel   = "Alt+F4";
}

void StdCmdQuit::activated(int iMsg)
{

}
bool StdCmdQuit::isActive()
{
	return 0;
}

// ------------------------------------------- [4/15/2013 Administrator]

DEF_STD_CMD_A(StdCmdReset)
StdCmdReset::StdCmdReset(void)
:Command("Std_Reset")
{
	sGroup     = QT_TR_NOOP("File");
	sMenuText  = QT_TR_NOOP("&Reset");
	sToolTipText = QT_TR_NOOP("Reset");
	sWhatsThis  = "Std_Reset";
	sStatusTip = QT_TR_NOOP("Reset");
	sPixmap   = "document-new";
}

void StdCmdReset::activated(int iMsg)
{

}
bool StdCmdReset::isActive()
{
	return 0;
}

// ----------------------------------------------- [5/31/2013 Administrator]

DEF_STD_CMD_A(StdCmdImport)
StdCmdImport::StdCmdImport()
:Command("Std_Import")
{
	sGroup        = QT_TR_NOOP("File");
	sMenuText     = QT_TR_NOOP("&Import...");
	sToolTipText  = QT_TR_NOOP("Import a file in the active document");
	sWhatsThis    = "Std_Import";
	sStatusTip    = QT_TR_NOOP("Import a file in the active document");

	sAccel        = "Ctrl+I";
}
void StdCmdImport::activated(int msg)
{
   GetApplication().getActiveDocument()->addObject("type","objectname");
}
bool StdCmdImport::isActive()
{
   return true;
}

void CreateStdCommands(void)
{
	CommandManager& CmdMgr = Application::Instance()->commandMananger();

	CmdMgr.addCommand(new StdCmdOpen());
	CmdMgr.addCommand(new StdCmdQuit());
	CmdMgr.addCommand(new StdCmdReset());
	CmdMgr.addCommand(new StdCmdSave());
	CmdMgr.addCommand(new StdCmdImport());
}

